// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'

import axios from 'axios'
import { post, fetch, patch, put } from 'services/index'
//定义全局变量
Vue.prototype.$post = post;
Vue.prototype.$fetch = fetch;
Vue.prototype.$patch = patch;
Vue.prototype.$put = put;

Vue.config.productionTip = false

import { AlertPlugin, ToastPlugin, LoadingPlugin } from 'vux'
Vue.use(AlertPlugin)
Vue.use(ToastPlugin)
Vue.use(LoadingPlugin)


// 设置html字体大小
document.documentElement.style.fontSize = window.innerWidth / 21.6 + 'px'

// 定义全局变量
window.xmview = {
    showAlert(title, content) {
        Vue.$vux.alert.show({
            title: title,
            content: content
        });
    },
    showToast(msg, postion) {
        Vue.$vux.toast.text(msg, postion)
    },
    shwoLoading(msg) {
        Vue.$vux.loading.show({
            text: msg
        })
    },
    hideLoading() {
        Vue.$vux.loading.hide()
    }

}
window.xmrouter = router
    // window.xmconfig = {
    //     apiHost: config.apiHost,
    // }

/* eslint-disable no-new */
new Vue({
    el: '#app',
    router,
    render: h => h(App)
})

export default {}